package com.assets.Fragment;

import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.assets.Polling.Inspection;
import com.assets.Polling.Outliers;
import com.assets.Polling.Solution;
import com.assets.R;
import com.assets.menu.SlideSideMenuExampleActivity;
import com.lemonade.widgets.slidesidemenu.SlideSideMenuTransitionLayout;

/**
 * Created by Administrator on 2019/4/24.
 */

public class Polling extends Fragment {
    private SlideSideMenuExampleActivity myActivity;
    private LinearLayout spot_check;//点检
    private LinearLayout outliers;//异常点
    private ImageView opmenu;//菜單
    private LinearLayout solution;//解决方案
    private LinearLayout search;//异常查询

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.polling, null);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        myActivity = (SlideSideMenuExampleActivity) getActivity();
        inview();
    }

    private void inview() {
        opmenu = (ImageView) myActivity.findViewById(R.id.opmenu);
        search = (LinearLayout) myActivity.findViewById(R.id.search);
        solution = (LinearLayout) myActivity.findViewById(R.id.solution);
        outliers = (LinearLayout) myActivity.findViewById(R.id.outliers);
        spot_check= (LinearLayout) myActivity.findViewById(R.id.spot_check);
        opmenu.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SlideSideMenuTransitionLayout mSlideSideMenu= (SlideSideMenuTransitionLayout)getActivity().findViewById(R.id.slide_side_menu);
                mSlideSideMenu.toggle();
            }
        });
        spot_check.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(myActivity,Inspection.class);
                startActivity(intent);
            }//点检
        });
        outliers.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent =new Intent(myActivity, Outliers.class);
                startActivity(intent);
            }//异常点
        });
        solution.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(myActivity,Solution.class);
                startActivity(intent);
            }//解决方案
        });
        search.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(myActivity,Solution.class);
                startActivity(intent);
            }//异常搜索
        });
    }
}
